package com.gejingyu.spring.jdbc;

import com.alibaba.druid.pool.DruidDataSource;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestJdbc {

    @Test
    public void Test01(){
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setUrl("jdbc:mysql://localhost:3306/spring?serverTimezone=UTC");
        dataSource.setUsername("root");
        dataSource.setPassword("123456");
        dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
    }

    @Test
    public void Test02(){
        ApplicationContext context =
                new ClassPathXmlApplicationContext("beanJdbc.xml");
        DruidDataSource dataSource = (DruidDataSource) context.getBean("druidDataSource");
        dataSource.getUrl();
    }
}
